<?php
use yii\web\View;
use app\assets\DaddyCallAsset;
use yii\helpers\Url;
DaddyCallAsset::register($this); 
$this->title = $this->context->pageTitle.Yii::$app->params['titleSuffix'];
$this->params['breadcrumbs'] = [
  'DaddyCall'
];
?>
<div class="page-header">
  <h1>
    DaddyCall
  </h1>
</div>
<div class="panel panel-default">
  <div class="panel-heading">
    <i class="fa fa-plus-circle"></i>
    DaddyCall
    <ul class="list-inline list-unstyled pull-right">
      <li>
        <a href="#">
          <i class="fa fa-chevron-up"></i>
        </a>
      </li>
    </ul>
  </div>
  <div class="panel-body">
    <div class="row">
      <div class="col-md-6 col-sm-6 col-md-offset-3 col-sm-offset-3">
        <form>
          <fieldset>
            <legend>1. 导入Tanx 广告位</legend>
              <div class="form-group">
                <div class="text-center">
                  <a href="javascript:void(0);" class="btn btn-success" data-loading-text="<i class='fa fa-spinner fa-spin'></i> 加载中..." id="import-operate-btn">
                    <i class="fa fa-download"></i>导入客户广告位信息
                  </a>
                </div>
              </div>
          </fieldset>
        </form>
      </div>
      <div class="col-md-6 col-sm-6 col-md-offset-3 col-sm-offset-3">
        <form action="<?= Url::to(['get-creative-info']);?>" class="form-horizontal mb20" id="get-creative-form">
          <fieldset>
            <legend>2. 查询创意上传审核状态</legend>
              <div class="form-group">

                  <label class="col-sm-2 control-label pr0"> 渠道：</label>
                  <div class="col-sm-8">
                    <label class="radio-inline">
                      <input id="channel_radio" type="radio" name="content_channel_radio" value="1" checked>
                          万流客
                    </label>
                    <label class="radio-inline">
                      <input id="channel_radio" type="radio" name="content_channel_radio" value="2" >
                          Tanx
                    </label>
              </div>
            </div>
            <div class="form-group">
            
                <label class="col-sm-2 control-label pr0"> 创意ID：</label>
                <div class="col-sm-3">
                  <input type="text" class="form-control" id="creative_id" value="" name="creative" placeholder="创意ID">
                  <div class="help-block text-error" id="creative_id_err"></div>
                </div>
                <div class="col-md-4  button-group">
                  <button type="submit" class="btn btn-success" data-loading-text="<i class='fa fa-spinner fa-spin'></i> 数据提交中...">查询</button>
                </div>
              </div>
              <div class="help-block " id="creative_info"></div>
          </fieldset>
        </form>
      </div>
      <div class="col-md-6 col-sm-6 col-md-offset-3 col-sm-offset-3">
        <form action="<?= Url::to(['solution-cost-import']);?>" class="form-horizontal mb20" id="solution-import-form">
          <fieldset>
            <legend>3. 策略花费数据导入</legend>
              <div class="form-group">
                <label for="range_date" class="col-sm-2 control-label pr0">
                  时间：
                </label>
                <div class="col-sm-6">
                  <div class="input-group">
                    <span class="input-group-btn">
                      <button class="btn btn-default" id="range-date-btn" type="button"><i class="fa fa-calendar"></i></button>
                    </span>
                    <input type="text" class="form-control" id="range_date" name="date" value="" placeholder="选择日期" readonly>
                  </div>
                  <div class="help-block text-error" id="range_date_err"></div>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label pr0"> 策略ID：</label>
                <div class="col-sm-6">
                  <input type="text" class="form-control" id="solution_id" value="" name="solution" placeholder="策略ID">
                  <div class="help-block text-error" id="solution_id_err"></div>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label pr0"> 品牌：</label>
                <div class="col-sm-6">
                  <select class="form-control" name="brand" id="brand">
<!--                     <option value="1">1</option>
                    <option value="2">2</option> -->
                    <?php
                      $currentAdvertiserId = '';
                      $noBrand = \Yii::t('common', 'No Brand');
                      if(count($_SESSION['domainAdvertisers']) ==0) {               
                        echo "<option value='' >$noBrand</option>";
                      }
                      foreach ($_SESSION['domainAdvertisers'] as $advertiser) {
                        $id = $advertiser['id'];
                        $name = $advertiser['name'];
                        $isSelected = '';
                        if ($id == $currentAdvertiserId) {
                          $isSelected = "selected";
                        }
                        echo "<option value='$id' $isSelected>$name</option>";
                      }
                    ?>
                  </select>
                  <div class="help-block text-error" id="brand_err"></div>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label pr0"> 花费：</label>
                <div class="col-sm-6">
                  <input type="text" class="form-control" id="cost" value="" name="cost" placeholder="花费">
                  <div class="help-block text-error" id="cost_err"></div>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label pr0"> 曝光：</label>
                <div class="col-sm-6">
                  <input type="text" class="form-control" id="show" value="" name="show" placeholder="曝光">
                  <div class="help-block text-error" id="show_err"></div>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label pr0"> 点击：</label>
                <div class="col-sm-6">
                  <input type="text" class="form-control" id="click" value="" name="click" placeholder="点击">
                  <div class="help-block text-error" id="click_err"></div>
                </div>
              </div>
              <div class="form-group">
                <div class="col-sm-2 col-sm-offset-4">
                  <button type="submit" class="btn btn-success" data-loading-text="<i class='fa fa-spinner fa-spin'></i> 数据提交中...">提交</button>
                </div>
              </div>
          </fieldset>
        </form>
      </div>
    </div>
  </div>
</div>

<div class="modal fade" id="upload-material-modal">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title">上传素材</h4>
      </div>
      <div class="modal-body">
        <div id="modal-loading-wrap" class="loading-wrap"></div>
        <div class="portlet-content">
          <span class="btn btn-success btn-sm fileinput-button">
            <i class="fa fa-plus"></i>
            <span>选择文件</span>
            <input id="creative-id" type="hidden" name="creative_id" value="${id}" >
            <!-- The file input field used as target for the file upload widget -->
            <input type="file" multiple="" name="files[]" id="fileupload">
          </span>
          <br>
          <br>
          <!-- The global progress bar -->
          <div class="progress" id="progress">
              <div aria-valuemax="100" aria-valuemin="0" class="progress-bar progress-bar-success progress-bar-striped">0%</div>
          </div>
          <!-- The container for the uploaded files -->
          <div class="files" id="files">
            <table class="table table-striped">
              <thead>
                <tr>
                  <th>文件名称</th>
                  <th>文件大小(KB)</th>
                  <th>上传时间</th>
                  <th>判断信息</th>
                  <th>上传者</th>
                </tr>
              </thead>
              <tbody></tbody>
              </table>
            </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="button" class="btn btn-primary" id="upload-confirm-operate" data-import-status="">确定</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<?php
  // $dataUrl = Url::to(['get-advertiser-data']);
  //$dataUrl = Yii::getAlias('@web').'/response/home/homeDataList.php';
  // $this->registerJs("VAM.setVar('DATA_LIST_URL','$dataUrl');", View::POS_HEAD);
    $importUrl = Url::to(['import-data']);
    $this->registerJs("VAM.setVar('DATA_IMPORT_URL','$importUrl');",View::POS_HEAD);
    // $this->registerJsFile("@web/js/daddyCall/sl.index.js", ['depends' => 'app\assets\DaddyCallAsset']);
?>
<script type="text/javascript" >
  requirejs(["<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/js/site.js"], function(common) {
    requirejs(["<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/js/daddyCall/daddyCall.js"]);
  });
</script>